cmake_minimum_required(VERSION 3.12)
project(gescpp)

cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

IF (APPLE)
    set(Boost_USE_STATIC_LIBS ON)
ENDIF (APPLE)
set(CMAKE_PREFIX_PATH ${TORCH_CMAKE_PATH})
find_package(Torch REQUIRED)
find_package(Boost COMPONENTS python${PYTHON_VERSION} numpy${PYTHON_VERSION} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${TORCH_CXX_FLAGS} -O3")

add_library(gescpp SHARED src/ges.cpp)
set_target_properties(gescpp PROPERTIES PREFIX "" SUFFIX ".so")
target_link_libraries(gescpp "${TORCH_LIBRARIES}" ${Boost_LIBRARIES})
set_property(TARGET gescpp PROPERTY CXX_STANDARD 20)
IF (APPLE)
    set(CMAKE_SHARED_LINKER_FLAGS "-undefined dynamic_lookup")
ENDIF (APPLE)
